#include "bsp_fan.h"
#include "tim.h"

extern TIM_HandleTypeDef htim2;
uint8_t setFanSpeed(uint32_t speed)
{
	__HAL_TIM_SET_COMPARE(&htim2, TIM_CHANNEL_2, speed);
	return 0;
}
	
void fan_example(void)
{
	HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_2);
	for (uint16_t i = 0; i < 6; i++)
	{
		setFanSpeed(6553 * i * 2);
		HAL_Delay(4000);
	}
}

uint8_t stopFan(void)
{
	HAL_TIM_PWM_Stop(&htim2,TIM_CHANNEL_2);
	return 0;
}
uint32_t getFanFreq(void)
{
	//暂不支持 需要capture；
	return 0;
}
